//
//  LTCollectionViewCell.m
//  中关村在线
//
//  Created by hy on 16/1/18.
//  Copyright © 2016年 hongyu. All rights reserved.
//

#import "LTCollectionViewCell.h"
#import "ThreeTableViewCell.h"
@interface LTCollectionViewCell ()<UITableViewDataSource, UITableViewDelegate>
@property (nonatomic, retain) UITableView *table;
@end
@implementation LTCollectionViewCell


- (void)dealloc {
    [_table release];
    [super dealloc];
}
- (instancetype)initWithFrame:(CGRect)frame {
    self = [super initWithFrame:frame];
    if (self) {
        [self cteateTable];
    }
    return self;
}
- (void)cteateTable {
    self.table = [[UITableView alloc] init];
    [self.contentView addSubview:_table];
    [_table release];
}
- (void)applyLayoutAttributes:(UICollectionViewLayoutAttributes *)layoutAttributes {
    _table.frame = CGRectMake(0, 0, layoutAttributes.frame.size.width, self.frame.size.height);
    _table.rowHeight = 250;
    _table.delegate = self;
    _table.dataSource = self;
    _table.separatorStyle = UITableViewCellSeparatorStyleNone;
    [_table registerNib:[UINib nibWithNibName:@"ThreeTableViewCell" bundle:[NSBundle mainBundle]] forCellReuseIdentifier:@"cell"];
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    return 10;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    ThreeTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"cell" forIndexPath:indexPath];
    cell.selectionStyle = UITableViewCellSelectionStyleNone;
    return cell;
}

@end
